package com.ubb.damate.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/** The persistent class for the workspace database table. */
@Entity
@Table(name = "workspace")
public class Workspace implements Serializable {
	private static final long	serialVersionUID	= 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "WorkspaceId", unique = true, nullable = false)
	private int					workspaceId;

	@Temporal(TemporalType.DATE)
	@Column(name = "CreationDate", nullable = false)
	private Date				creationDate;

	@Lob()
	@Column(name = "Path", nullable = false)
	private String				path;

	@Column(name = "Username", nullable = false, length = 20)
	private String				username;

	//bi-directional many-to-one association to Project
	@OneToMany(mappedBy = "workspace")
	private Set<Project>		projects;

	public Workspace() {
	}

	public Workspace(Date creationDate, String username, String path) {
		this.creationDate = creationDate;
		this.username = username;
		this.path = path;
	}

	public int getWorkspaceId() {
		return this.workspaceId;
	}

	public void setWorkspaceId(int workspaceId) {
		this.workspaceId = workspaceId;
	}

	public Date getCreationDate() {
		return this.creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public String getPath() {
		return this.path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Set<Project> getProjects() {
		return this.projects;
	}

	public void setProjects(Set<Project> projects) {
		this.projects = projects;
	}

}